package com.jinit.rpc.consumer.controller;

import com.jinit.rpc.api.pojo.Order;
import com.jinit.rpc.api.service.OrderService;
import com.jinit.rpc.consumer.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 订单接口
 *
 * @author JInit
 * @date 2021-08-29
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Reference
    private OrderService orderService;

    /**
     * 获取订单
     * @param id 订单ID
     * @return
     */
    @GetMapping("/{id}")
    public Order getOrderById(@PathVariable int id) {
        return orderService.getOrderById(id);
    }
}
